/*
 * Copyright (c) 2015 DHC Corporation.
 */
package cn.com.dhc.danlu.widget.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * 订单画面Group（卖家）用PagerAdapter
 *
 * @author MuWei
 * @version 1.00 2015/02/08 新建
 */
public class DeliverySellerPagerAdapter extends PagerAdapter {

    /**
     * Activity的View列表
     */
    private ArrayList<View> activityViews;

    public DeliverySellerPagerAdapter (ArrayList<View> activityViews) {
        this.activityViews = activityViews;
    }

    @Override
    public int getCount () {
        return activityViews.size ();
    }

    @Override
    public Object instantiateItem (ViewGroup container, int position) {
        View view = activityViews.get (position);
        container.addView (view);
        return view;
    }

    @Override
    public void destroyItem (ViewGroup container, int position, Object object) {
        container.removeView ((View) object);
    }

    @Override
    public boolean isViewFromObject (View arg0, Object arg1) {
        return arg0 == arg1;
    }
}
